package com.exchangeek.server.entity.bean;

import com.google.gson.Gson;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import javax.persistence.Entity;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Project Name: Exchangeek_Server
 * Date Created: 2013/09/12 下午3:58
 *
 * @author Wings
 */

@Entity
@JsonAutoDetect
@JsonIgnoreProperties(ignoreUnknown = true)
public class User {
    private String userName;
    private String passHash;
    private HashMap skills;

    public User() {
        this.skills = new HashMap();
    }

    public String getUserName() {
        return userName;
    }

    public User setUserName(String userName) {
        this.userName = userName;
        return this;
    }

    public String getPassHash() {
        return passHash;
    }

    public User setPassHash(String passHash) {
        this.passHash = passHash;
        return this;
    }

    public HashMap getSkills() {
        return skills;
    }

    public void setSkills(HashMap skills) {
        this.skills = skills;
    }

    public String jsonGetSkills() {
        Gson gson = new Gson();
        return gson.toJson(this.skills);
    }

    public User jsonSetSkills(String skillsJson) {
        Gson gson = new Gson();
        this.skills = new HashMap();
        this.skills = gson.fromJson(skillsJson, this.skills.getClass());
        return this;
    }

}
